package controllers

import (
	"databaseStudy/models/globalValues"
	beego "github.com/beego/beego/v2/server/web"
)

type CheckTokenController struct {
	beego.Controller
}
type checkResponse struct {
	Res bool `json:"res"`
}

// Post check token 是否存在
func (c CheckTokenController) Post()  {
	token:=c.GetString("token")
	res:=globalValues.CheckToken(token)
	if res{
		c.Data["json"]=checkResponse{true}
	}else{
		c.Data["json"]=checkResponse{false}
	}
	_=c.ServeJSON()
}
